import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/Layout.vue'
import Design from '../design/Design'

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: "/user",
    children: [
      {
        path: '/user',
        name: 'User',
        component: () => import("@/views/User"),
      },
      {
        path: '/news',
        name: 'News',
        component: () => import("@/views/News"),
      },
      {
        path: '/index',
        name: 'Index',
        component: () => import("@/views/Index"),
      },
      {
        path: '/book',
        name: 'Book',
        component: () => import("@/views/Book"),
      }
    ]
  },
  {
    path: '/',
    name: 'Design',
    component: Design,
    redirect: "/index",
    children: [
      {
        path: '/index',
        name: 'Index',
        component: () => import("@/views/Index"),
      },
      {
        path: '/recommend',
        name: 'Recommend',
        component: () => import("@/views/Recommend"),
      },
      {
        path: '/typekh',
        name: 'Typekh',
        component: () => import("@/views/Typekh"),
      },
      {
        path: '/typexs',
        name: 'Typexs',
        component: () => import("@/views/Typexs"),
      },
      {
        path: '/typexy',
        name: 'Typexy',
        component: () => import("@/views/Typexy"),
      },
      {
        path: '/typemh',
        name: 'Typemh',
        component: () => import("@/views/Typemh"),
      },
      {
        path: '/MediaContent/:id',
        name: 'MediaContent',
        component: () => import("@/views/MediaContent"),
      },
      {
        path: '/recommends',
        name: 'Recommends',
        component: () => import("@/views/Recommends"),
      },
    ]
  },
  {
    path: '/Login',
    name: 'Login',
    component: () => import("@/views/Login")
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import("@/views/Register")
  },
  {
    path: '/person',
    name: 'Person',
    component: () => import("@/views/Person"),
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
